using Oracle.ManagedDataAccess.Client;

namespace OracleInternal.ConnectionPool
{
	internal class ConnectionPoolId
	{
		private int m_hashCode;

		internal OracleCredential m_orclCredential;

		internal string m_pwdLessconnString;

		internal ConnectionPoolId(string connString, OracleCredential orclCredential)
		{
			m_pwdLessconnString = connString;
			m_orclCredential = orclCredential;
			CalculateHashCode();
		}

		public override bool Equals(object obj)
		{
			bool result = false;
			ConnectionPoolId connectionPoolId = obj as ConnectionPoolId;
			if (connectionPoolId != null)
			{
				result = ((connectionPoolId.m_orclCredential != null && !connectionPoolId.m_orclCredential.m_bInternalUse) ? (m_orclCredential == connectionPoolId.m_orclCredential && m_pwdLessconnString == connectionPoolId.m_pwdLessconnString) : (m_pwdLessconnString == connectionPoolId.m_pwdLessconnString));
			}
			return result;
		}

		public override int GetHashCode()
		{
			return m_hashCode;
		}

		private void CalculateHashCode()
		{
			m_hashCode = m_pwdLessconnString.GetHashCode() * 11;
			if (m_orclCredential != null && !m_orclCredential.m_bInternalUse)
			{
				m_hashCode += m_orclCredential.GetHashCode();
			}
		}
	}
}
